From: Andreas Brauchli Date: Mon, 27 Oct 2014 22:35:35 +0000 (-1000) Subject: Calendar: Inline _ellipsizeEventTime into caller X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~2005 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=fb5b368ca773c200358cf04e553778a7d254ac06;p=gnome-shell.git Calendar: Inline _ellipsizeEventTime into caller This patch inlines the function _ellipsizeEventTime into its only caller _addEvent. This also removes the need for the global const EventEllipses and is thus removed by this commit as well. https://bugzilla.gnome.org/show_bug.cgi?id=727302 --- diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 2c4368901..e639ef739 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -14,12 +14,6 @@ const Shell = imports.gi.Shell; const MSECS_IN_DAY = 24 * 60 * 60 * 1000; const SHOW_WEEKDATE_KEY = 'show-weekdate'; const ELLIPSIS_CHAR = '\u2026'; -const EventEllipses = { - NONE: 0, - BEFORE: 1 << 0, - AFTER: 1 << 1, - BOTH: ~0 -}; // alias to prevent xgettext from picking up strings translated in GTK+ const gtk30_ = Gettext_gtk30.gettext; @@ -66,18 +60,6 @@ function _getEndOfDay(date) { return ret; } -function _ellipsizeEventTime(event, periodBegin, periodEnd) { - if (event.allDay) - return EventEllipses.NONE; - - let ret = EventEllipses.NONE; - if (event.date < periodBegin) - ret = EventEllipses.BEFORE; - if (event.end > periodEnd) - ret |= EventEllipses.AFTER; - return ret; -} - function _formatEventTime(event, clockFormat, periodBegin, periodEnd) { let ret; let allDay = (event.allDay || (event.date <= periodBegin && event.end >= periodEnd)); @@ -779,16 +761,15 @@ const EventsList = new Lang.Class({ timeLabel.clutter_text.line_wrap = false; timeLabel.clutter_text.ellipsize = false; - let ellipses = _ellipsizeEventTime(event, periodBegin, periodEnd); let preEllipsisLabel = new St.Label({ style_class: 'events-day-time-ellipses', text: ELLIPSIS_CHAR, y_align: Clutter.ActorAlign.START }); let postEllipsisLabel = new St.Label({ style_class: 'events-day-time-ellipses', text: ELLIPSIS_CHAR, y_align: Clutter.ActorAlign.START }); - if (!(ellipses & EventEllipses.BEFORE)) + if (event.allDay || event.date >= periodBegin) preEllipsisLabel.opacity = 0; - if (!(ellipses & EventEllipses.AFTER)) + if (event.allDay || event.end <= periodEnd) postEllipsisLabel.opacity = 0; let timeLabelBoxLayout = new St.BoxLayout();